package plugin;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * Panel, 2 Labels untereinander (Grid)
 * @author Duncyo
 *
 */
public class DoubleLabelPane extends JPanel {
	private static final long serialVersionUID = 1L;

	protected DoubleLabelPane(String top, String bottom) {
		this(top, bottom, JLabel.LEFT);
	}

	protected DoubleLabelPane(String top, String bottom, int align) {
		this(top,bottom,align,null,null);
	}
	protected DoubleLabelPane(String top, String bottom, int align, Font font_top, Font font_bottom) {
		this.setLayout(new GridLayout(2, 1));
		JLabel label_top = new JLabel(top, align);
		if (font_top!=null) label_top.setFont(font_top);
		this.add(label_top);
		JLabel label_bottom = new JLabel(bottom, align);
		if (font_bottom!=null) label_bottom.setFont(font_bottom);
		this.add(label_bottom);
		this.setOpaque(false);
	}
	
	@Override
	public void setFont(Font font) {
		for (Component c : getComponents()) {
			c.setFont(font);
		}
	}
	
	@Override
	public void setForeground(Color color) {
		for (Component c : getComponents()) {
			c.setForeground(color);
		}
	}

}
